﻿using System.Windows;
using System.Windows.Automation.Peers;
using System.Windows.Automation.Provider;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;

namespace WpfControlss
{
    /// <summary>
    /// ButtonSample.xaml 的交互逻辑
    /// </summary>
    public partial class ButtonSample : Page
    {
        public ButtonSample()
        {
            InitializeComponent();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {

        }

        private void btnTest_Click(object sender, RoutedEventArgs e)
        {
            MessageBox.Show("Test");
            ButtonAutomationPeer bap = new ButtonAutomationPeer(btnAutoPeer);
            IInvokeProvider provider = bap.GetPattern(PatternInterface.Invoke) as IInvokeProvider;
            provider.Invoke();
        }

        private void btnAutoPeer_Click(object sender, RoutedEventArgs e)
        {
            MessageBox.Show("AutoPeer");
        }

        private void button4_Click(object sender, RoutedEventArgs e)
        {
            MessageBox.Show((sender as Button).Content.ToString());
        }



        int num = 0;
        private void RepeatButton_Click(object sender, RoutedEventArgs e)
        {
            var btn = sender as RepeatButton;
            num += btn.Content.Equals("Increase") ? 1 : -1;
            txt.Text = num.ToString();

        }

      
    }
}
